package moviles;

import android.graphics.Bitmap;
import android.graphics.Canvas;

public class Avion extends Movil {

	public Avion(Bitmap img, int xPos, int yPos) {
		super(img, xPos, yPos);
	}
	
	public void subirAvion(){
		this.setY(getY()-5);
	}
	
	public void bajarAvion(){
		this.setY(getY()+5);
	}
	
	public void moverAvion(boolean click, Canvas canvas,int piso){
		if(click){
			if(this.getY()<0){
				this.setY(this.getY());
			}
			else
				this.setY(this.getY()-8);
		}else{
			if(this.getY()+this.getImage().getHeight()>canvas.getHeight()-piso)
				this.setY(this.getY());
			else
				this.setY(this.getY()+8);
		}
	}
	
	public int moverAvionAcel(float valAcel){
		if(valAcel<=-3){
			return -10;
		}else if(-3<=valAcel && valAcel<= -1){
			return -5;
		}else if(-1<=valAcel && valAcel<=1){
			return 0;
		}else if(1<=valAcel && valAcel<=3){
			return 5;
		}else if(3<=valAcel){
			return 10;
		}
		return 0;
	}

}
